Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

load-helpers

Package Overview
Dependencies
Maintainers
2
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

load-helpers

Load helpers with patterns, as an object, key-value pair, or module.

  • 0.3.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
26K
decreased by-13.92%
Maintainers
2
Weekly downloads
 
Created
Source

load-helpers NPM version NPM downloads Build Status

Load helpers with patterns, as an object, key-value pair, or module.

Install

Install with npm:

$ npm install --save load-helpers

Usage

var loader = require('load-helpers');
// optionally pass an object to use for caching the helpers
var cache = {};
var helpers = loader(cache);

// object of helpers
helpers({
  a: function() {},
  b: function() {},
  c: function() {}
});

// key-value pairs
helpers('d', function() {});
helpers('e', function() {});
helpers('f', function() {});

// glob pattern or file path, string or array
helpers('helpers/*.js'); // g, h, i

// required from node_modules
helpers('j');

Results in:

{
  a: function(){},
  b: function(){},
  c: function(){},
  d: function(){},
  e: function(){},
  f: function(){},
  g: function(){},
  h: function(){},
  i: function(){},
  j: function(){}
}

options.renameKey

When requiring helpers from a filepath or node_modules a renameKey function may be passed on the helper's options to customize how the key is named:

Example

helpers('for-own', {
  renameKey: function (key) {
    // naive camelize
    return key.replace(/\W(.)/g, function (_, ch) {
      return ch.toUpperCase();
    });
  }
});
//=> {forOwn: [function]}

About

  • handlebars-helpers: More than 130 Handlebars helpers in ~20 categories. Helpers can be used with Assemble, Generate… more | homepage
  • helper-cache: Easily register and get helper functions to be passed to any template engine or node.js… more | homepage
  • template-helpers: Generic JavaScript helpers that can be used with any template engine. Handlebars, Lo-Dash, Underscore, or… more | homepage
  • templates: System for creating and managing template collections, and rendering templates with any node.js template engine… more | homepage

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Building docs

(This document was generated by verb-generate-readme (a verb generator), please don't edit the readme directly. Any changes to the readme must be made in .verb.md.)

To generate the readme and API documentation with verb:

$ npm install -g verb verb-generate-readme && verb

Running tests

Install dev dependencies:

$ npm install -d && npm test

Author

Jon Schlinkert

License

Copyright © 2016, Jon Schlinkert. Released under the MIT license.


This file was generated by verb, v0.9.0, on July 23, 2016.

Keywords

FAQs

Package last updated on 23 Jul 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc